package com.xbongbong.pro.statistic.enums;

import lombok.Getter;

import java.util.Objects;

/**
 * @Author: 汪腾伟
 * @Description：相应业务下的下拉选
 * @Date: Created in 2021/6/1 11:03
 */
@Getter
public enum BusinessComboEnum {

    FUND_ACCOUNT_INCOME_EXPENDITURE(1, FilterConditionEnum.FUND_ACCOUNT_SHEET_TYPE.getCode());

    /**
     * 业务标识
     */
    private Integer businessTag;

    /**
     * 业务标识下的具体哪个搜索内容
     * @see com.xbongbong.pro.statistic.enums.FilterConditionEnum
     */
    private Integer filterConditionCode;

    BusinessComboEnum (Integer businessTag, Integer filterConditionCode) {
        this.businessTag = businessTag;
        this.filterConditionCode = filterConditionCode;
    }

    /**
     * 根据业务标识以及下拉选标识去获取
     *
     * @param businessTag
     * @param filterConditionCode
     * @return
     */
    public static BusinessComboEnum getEnumByTagAndCode(Integer businessTag, Integer filterConditionCode) {
        for (BusinessComboEnum businessComboEnum : BusinessComboEnum.values()) {
            if (Objects.equals(businessComboEnum.getBusinessTag(), businessTag) && Objects.equals(businessComboEnum.getFilterConditionCode(), filterConditionCode)) {
                return businessComboEnum;
            }
        }
        return null;
    }
}
